package com.baosight.sczx.zm.cn.service;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.StaticBlocks;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cn.domain.ZMCNStock;

/**
 * 质检中心综合管理
 */
public class ServiceZMCN50 extends ServiceEPBase{
	
	public EiInfo initLoad(EiInfo inInfo) {
		String mzCode = InitialData.getInstance().getEiBlockByNo("cmes.cn.meizhiCode").getCellStr(0, "display");
		inInfo.addBlock(Department.getInstance().getMiningDepts("cmes.cp.department", "orgCode", "orgName", true, mzCode));
		inInfo.addBlock(StaticBlocks.getMonthBlock(0, true));
		inInfo.set("inqu_status-0-departmentCode", UserSession.getInSessionProperty("orgCode"));//单位的默认值
		inInfo.set("inqu_status-0-departmentName", UserSession.getInSessionProperty("orgName"));//单位的默认值
	//	System.out.println(UserSession.getInSessionProperty("orgName"));
		return inInfo;
	}
	
	public EiInfo query(EiInfo inInfo){
		String fdCurrentDate=inInfo.getString("fdCurrentDate");
		if(fdCurrentDate==null||fdCurrentDate.trim().equals("")){
			fdCurrentDate=StaticTools.getDate();
		}
		StaticTools.setQueryParameters(inInfo, "fdCurrentDate", fdCurrentDate, true);
 		EiInfo outInfo = super.query(inInfo, "ZMCNStock.totalsum", new ZMCNStock());
 		outInfo.set("inqu_status-0-departmentCode", UserSession.getInSessionProperty("orgCode"));//单位的默认值
 		outInfo.set("inqu_status-0-departmentName", UserSession.getInSessionProperty("orgName"));//单位的默认值
 		return outInfo;
	}
} 